<template>
  <div id="app" style="height:100%;overflow:auto">
    <template v-if="isShow">
      <router-view />
    </template>
  </div>
</template>

<script>
  import {
    mapActions
  } from 'vuex';
  import Vue from 'vue';

  export default Vue.extend({
    data() {
      return {
        isShow: false
      };
    },

    mounted() {
      let width, height;
      if (process.env.isMiniprogram) {
        width = wx.getSystemInfoSync().windowWidth;
        height = wx.getSystemInfoSync().windowHeight;
      } else {
        width = document.body.clientWidth;
        height = document.body.clientHeight;
        let fontSize = (width / 750) * 16;
        document.documentElement.style.fontSize = fontSize + 'px';
      }

      this.setWidthData(width);
      this.setHeightData(height);
      this.isShow = true;
    },

    methods: {
      ...mapActions(['setWidthData', 'setHeightData'])
    }
  });

</script>
